<?php


class RbacSeeder extends \Illuminate\Database\Seeder {
    public function run() {
        //角色初始填充
        \Xy\Rbac\Models\RbacRoleModel::insert([
            [
                'id'         => 1,
                'name'       => '超级管理员',
                'created_at' => date('Y-m-d H:i:s'),
                'updated_at' => date('Y-m-d H:i:s'),
            ],
        ]);
        
        //用户角色信息填充
        \Xy\Rbac\Models\RbacUserRoleModel::insert([
            [
                'id'         => 1,
                'user_id'    => 1,
                'role_id'    => 1,
                'created_at' => date('Y-m-d H:i:s'),
                'updated_at' => date('Y-m-d H:i:s'),
            ],
        ]);
        
        //用户信息填充
        App\User::insert([
            ['id' => 1, 'name' => 'zxz', 'email' => 'stn@xinyartech.com', 'password' => \Illuminate\Support\Facades\Hash::make('stn12321nts'), 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s'),],
        ]);
    
        //基础权限管理相关页面填充
        \Xy\Rbac\Models\RbacPowerPageModel::insert([
            ['id' => 1, 'title' => '权限管理', 'level' => 1, 'pid' => 0, 'route_name' => 'rbac'],
            ['id' => 2, 'title' => '页面', 'level' => 2, 'pid' => 1, 'route_name' => 'rbacPower'],
            ['id' => 3, 'title' => '角色', 'level' => 2, 'pid' => 1, 'route_name' => 'rbacRole'],
            ['id' => 4, 'title' => '用户角色分配管理', 'level' => 2, 'pid' => 1, 'route_name' => 'rbacUserPage'],
        ]);
    }
}